<template>
  <div class="demo">
    <el-descriptions  title="用户信息" direction="vertical" :column="4" border>
      <el-descriptions-item label="用户名">{{uname}}</el-descriptions-item>
      <el-descriptions-item label="手机号">{{uphone}}</el-descriptions-item>
      <el-descriptions-item label="备注">
        <el-tag size="small">{{type}}</el-tag>
      </el-descriptions-item>
    </el-descriptions>
  </div>
</template>
<script>
export default {
  name:'Message',
  data(){
      return{
        uname:'',
        uphone:'',
        utype:''
      }
  },
  methods:{
    async getUser(){
        const uid = this.$store.state.uid;
        const res = await this.$store.dispatch("getUserInfo",{uid});
        this.uname=res.uname;
        this.uphone=res.uphone;
        this.utype=res.utype;
      }
  },
  computed:{
    type(){
      const tp = this.utype;
            if(tp=='0'){
                return "卖家"
            }else if(tp=='1'){
                return "买家"
            }else{
                return "管理员"
            }
    },
  },
  mounted(){
    this.getUser();
  }
}
</script>
<style lang="less" scoped>
  .demo{
    width:500px;
    padding-left:50px ;
  }

</style>
